﻿<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="../images/favicon.ico">
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
<!-- 富文本编辑器 -->
<link rel="stylesheet" type="text/css"
	href="${path }/resource/plugin/kindeditor/themes/default/default.css" />
<link rel="stylesheet" type="text/css"
	href="${path }/resource/plugin/kindeditor/plugins/code/prettify.css" />
<link href="${path }/resource/css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/kindeditor.js"></script>
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/plugins/code/prettify.js"></script>
<style type="text/css">
	
</style>
<title></title>
</head>
<div class="ibox-content ">
	<form class="form-horizontal" id="dataform"
		onsubmit="javascripr:return false;">
		
		<input type="hidden" name="tokenUrl" value="${tokenUrl}">	 
		<input type="hidden" name="token" value="${token}">
		
		<input type="hidden" name="projId" value="${projId}">
		
		<c:if test="${obj ne null }">
			<input type="hidden" name="id" value="${obj.id }">
		</c:if>
		
		<div class="form-group">
			<label class="col-sm-2 control-label">标题</label>
			<div class="col-sm-3">
				<input type="text" name="title" value="<c:out value="${obj.title}"></c:out>"
					class="form-control radius" dataType="*1-50" nullmsg="标题不能为空">
				<div class="Validform_checktip"></div>
			</div>
		
			<label class="col-sm-2 control-label ">所属模块</label>
			<div class="col-sm-3">
				<select class="form-control select2" size="1" name="interfaceId"
						id="parentId" dataType="*" nullmsg="模块不能为空">
					<option value="" selected="selected">请选择项目模块</option>
				</select>				
			</div>			
		</div>
		<div class="Validform_checktip"></div>			
		
      	<div class="form-group">
			<label class="col-sm-2 control-label ">反馈内容</label>
			<div class="col-sm-8">
				<textarea name="content" id="artcontent">
					${obj.content}
				</textarea>
			</div>
			<div class="Validform_checktip"></div>
		</div>
      	
		<input type="hidden" name="fileUrl" id="fileUrl" value="${obj.fileUrl }">
		<div class="form-group">
		<label class="col-sm-2 control-label ">上传附件</label>
			<div class="col-sm-8">
				<input onclick="MTools.chooesFile('#fileText2')"
					class="input-text upload-url radius form-control" type="text" id="showFileName2" value="${obj.fileUrl }"
					readonly style="width: 30%;display: inline;"> 
					<a onclick="MTools.chooesFile('#fileText2')" class="btn btn-primary radius"> 
					<i   class="fa fa-cloud-upload"></i> 浏览文件 </a> 
					<input type="button" class='btn btn-primary radius'onclick="MTools.upFile('#submitBtn2')" value="上传"> 
			</div>
		</div>
       
		<div class="form-group ">
			<div class="col-sm-12 text-center">
				<a href="javascript:;" onclick="myForm.submit()" 
					class="btn btn-success radius">保存</a>&nbsp;&nbsp;&nbsp;&nbsp; 
					<button onclick="MTools.closeForm()" class="btn btn-danger radius" type="button">取消</button>
			</div>
		</div>
	</form>
	
	<iframe src="" name="blankFrame" id="blankFrame"
				style="height: 100px; width: 100px; display: none;"> </iframe>
	<form class="form form-horizontal" method="post" style="display: none;"
		enctype="multipart/form-data" target="blankFrame" 
		action="${path }/resource/plugin/kindeditor/zking_upload_json.jsp?fileType=file&hiddenId=fileUrl">
		<input id="fileText2" type="file" multiple name="file-1" onchange="MTools.selectFile('#showFileName2','#fileText2','')"  /> 
		<input type="submit" id="submitBtn2"/>
	</form> 
	
</div>
	
<script type="text/javascript">

 	var editor;
	var myForm;
	$(function() {	
		MTools.autoFullSelect();
		//带搜索的下拉框
		$(".select2").select2({'width':'100%'});
		$(".select2").trigger("blur");
  		var projId = ${projId};
  	  
	    //富文本框
		MUI.createEdit("content", '100%', '470px', 'editor',0);
		   //初始化模块
  		initFunctionList(projId);
		//表格初始化
		myForm=MForm.initForm({
			invokeUrl:"${path}/feedback/clientchanges/addOrModify",
			beforeSubmit:function(){
				editor.sync();
			},
			afterSubmit:function(){
				parent.myGrid.serchData();
			},
		});
		
	});
	
	//初始化项目模块
	function initFunctionList(projId) {
		console.log(projId);
		$.AjaxProxy({
			a : false,
		}).invoke(
			"${path}/feedback/clientchanges/showCateList?projId="+projId,
			function(loj) {
				$("#parentId").createSelectTree(
					loj.attr("result").rows, {
						append : true ,
						defaultValue: "${obj.interfaceId}"
					});
				});	
	}
	     

</script>
</body>
</html>